package com.example.usb.dao.entity;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.Index;
import org.greenrobot.greendao.annotation.Property;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.example.usb.greendao.DaoSession;
import com.example.usb.greendao.FaceInfoBeanDao;
import com.example.usb.greendao.PhotoPicBeanDao;

/**
 * Created Date 2019/2/25.
 *
 * @author liangkun
 * ClassDescription：图片bean
 */
@Entity
public class PhotoPicBean {
    //文件标识
    @Id
    @Index
    @Property(nameInDb = "md5")
    private String md5;
    @Property(nameInDb = "data_time")
    private String dataTime;//拍摄时间
    //一对多的关系,一张照片可能有多个人,所以会有多个人脸特征(一张脸一个特征)
    @ToMany(referencedJoinProperty = "faceMd5")
    List<FaceInfoBean> faceList;
    //是否人脸检测标志
    @Property(nameInDb = "detection")
    private String detection; //0代表未检测，//1代表检测
    //文件路径
    @Property(nameInDb = "file_path")
    private String filePath;
    //文件名称
    @Property(nameInDb = "file_name")
    private String fileName;
    //标识单个人脸还是多个人脸，1:单人，2：多人
    @Property(nameInDb = "figure_count")
    private String figureCount;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    /** Used for active entity operations. */
    @Generated(hash = 233598214)
    private transient PhotoPicBeanDao myDao;
    @Generated(hash = 1292290584)
    public PhotoPicBean(String md5, String dataTime, String detection,
            String filePath, String fileName, String figureCount) {
        this.md5 = md5;
        this.dataTime = dataTime;
        this.detection = detection;
        this.filePath = filePath;
        this.fileName = fileName;
        this.figureCount = figureCount;
    }
    @Generated(hash = 447435849)
    public PhotoPicBean() {
    }
    public String getMd5() {
        return this.md5;
    }
    public void setMd5(String md5) {
        this.md5 = md5;
    }
    public String getDataTime() {
        return this.dataTime;
    }
    public void setDataTime(String dataTime) {
        this.dataTime = dataTime;
    }
    public String getDetection() {
        return this.detection;
    }
    public void setDetection(String detection) {
        this.detection = detection;
    }
    public String getFilePath() {
        return this.filePath;
    }
    public void setFilePath(String filePath) {
        this.filePath = filePath;
    }
    public String getFileName() {
        return this.fileName;
    }
    public void setFileName(String fileName) {
        this.fileName = fileName;
    }
    public String getFigureCount() {
        return this.figureCount;
    }
    public void setFigureCount(String figureCount) {
        this.figureCount = figureCount;
    }
    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 364831015)
    public List<FaceInfoBean> getFaceList() {
        if (faceList == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            FaceInfoBeanDao targetDao = daoSession.getFaceInfoBeanDao();
            List<FaceInfoBean> faceListNew = targetDao
                    ._queryPhotoPicBean_FaceList(md5);
            synchronized (this) {
                if (faceList == null) {
                    faceList = faceListNew;
                }
            }
        }
        return faceList;
    }
    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 1860669821)
    public synchronized void resetFaceList() {
        faceList = null;
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1894285105)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getPhotoPicBeanDao() : null;
    }
}
